<ui:composition xmlns="http://www.w3.org/1999/xhtml"
				xmlns:ui="http://java.sun.com/jsf/facelets"
				xmlns:h="http://java.sun.com/jsf/html"
				xmlns:f="http://java.sun.com/jsf/core"
				xmlns:p="http://primefaces.prime.com.tr/ui"
				template="../../templates/ui2.xhtml">
<ui:define name="title">
	Cadastrar Usuário
</ui:define>

<ui:define name="content">
 	<div id="entryContentPanel">
 		
 <h:form>

	<div class="entry" style="line-height: 200%">
        <p:panel id="panel">
            <h:panelGrid columns="3" columnClasses="label, value, error" styleClass="grid">  
                <h:outputText value="Nome"/>  
                <p:inputText value="#{usuarioBean.usuario.nome}" required="true" requiredMessage="#{message.requiredMessage}" id="idNome" 
                	size="40" maxlength="100"/>
                <p:message for="idNome" />
                
                <h:outputText value="Apelido" />  
                <p:inputText value="#{usuarioBean.usuario.apelido}" required="true" requiredMessage="${message.requiredMessage}" id="idApelido" 
                	size="40" maxlength="20"/>
                <p:message for="idApelido" />
                
                <h:outputText value="Usuário" />
                <p:inputText value="#{usuarioBean.usuario.usuario}" required="true" requiredMessage="#{message.requiredMessage}" id="idUsuario" 
                	size="40" maxlength="20"/>
                <p:message for="idUsuario" />
                
                <h:outputText value="E-mail" />
                <p:inputText value="#{usuarioBean.usuario.email}" required="true" requiredMessage="#{message.requiredMessage}" id="idEmail" 
                	size="40" maxlength="70"/>
                <p:message for="idEmail" />
                
                <h:outputText value="Sexo" />
                <h:selectOneMenu value="#{usuarioBean.usuario.sexo}" >
                	<f:selectItem itemValue="M" itemLabel="Masculino" />
                	<f:selectItem itemValue="F" itemLabel="Feminino" />
               	</h:selectOneMenu>
               	<h:outputText />
                
                <h:outputText value="Status" />
                <h:selectOneMenu value="#{usuarioBean.usuario.status}" >
                	<f:selectItem itemValue="A" itemLabel="Ativo" />
                	<f:selectItem itemValue="I" itemLabel="Inativo" />
               	</h:selectOneMenu>
               	<h:outputText />
               	
               	<p:commandButton value="Cadastrar"  action="#{usuarioBean.cadastraUsuario}" 
               		update="panel, panel2, oplDialog" type="submit" ajax="false"/>
            	
            	<p:spacer width="1"/>
            	
            	<p:commandButton value="Limpar"  type="reset" />
            </h:panelGrid>
       </p:panel> 
       <br/>
       <br/>
       
       	<!-- Esse ajax em baixo não é tão legal quanto o de baixo. Fica para aprovação de vcs. -->
        <p:ajaxStatus style="width:16px;height:16px;" >
			<f:facet name="start">
				<h:graphicImage value="/design/ajaxloading.gif" />
			</f:facet>
			
			<f:facet name="complete" >
				<h:outputText value=""/>
			</f:facet>
		</p:ajaxStatus>
        
        <!-- Esse ajax aqui é legal
        < p : ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/>  
    		<p : dialog modal="true" widgetVar="statusDialog" header="Aguarde..."    
       			draggable="false" closable="false" >  
			<p : graphicImage value="/design/ajaxloadingbar.gif" />  
		</p :  dialog>
        -->
    </div>
     
</h:form>
 		
 		
 	</div> 
</ui:define>
</ui:composition>